package ac.leedsmet.devmanager.core;

import java.io.Serializable;

/**
 * The Issue object should only be created via the IssueManagerImpl class.
 * <pre>
 *     IssueManagerImpl issueManager = new IssueManagerImpl(project);
 *     issueManager.createIssue("issue name", "User");
 * </pre>
 * @author Samael
 * @author Takamura
 * @version 1.0
 * @see IssueManagerImpl#createIssue(String, String)
 */
public class Issue implements Serializable,Status {

    private long issueId;
    private String title;
    private String summary;
    private String creator;
    private String assignee;
    private boolean active =true;

    /**
     * There is no setter for creator as the constructor sets this variable
     * @return The creator of the Issue
     */
    public String getCreator() {
        return creator;
    }

    /**
     * @param title   Title of the issue
     * @param creator  Creator of the issue
     * @param issueId   Auto incremented and unique ID
     */
    public Issue(String title, String creator, long issueId) {
        this.issueId = issueId;
        this.title = title;
        this.creator = creator;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getAssignee() {
        return assignee;
    }

    public void setAssignee(String assignee) {
        this.assignee = assignee;
    }

    public String getTitle() {
        return title;
    }

    public  void setTitle(String title) {
        this.title = title;
    }

    public long getIssueId() {
        return issueId;
    }

    @Override
    public void deactivate() {
        this.active = false;
    }

    @Override
    public void activate() {
       this.active = true;
    }

    /**
     * @return Returns true if the active of the issue is active or false if the active of the issue is inactive
     */
    @Override
    public boolean isActive() {
        return active;
    }
}
